package 线程的学习;

public class TestPriority {
    public static void main(String args[]){
        Thread t1=new Thread(new MyThread3());
        Thread t2=new Thread(new MyThread4());
        t2.setPriority(Thread.MAX_PRIORITY);
        t1.start();
        t2.start();
    }

}
class MyThread3 extends Thread{
    @Override
    public void run() {
        //获取线程的优先级
        for(int i=0;i<10;i++){
            System.out.println("当前线程是："+currentThread().getName()+"，线程优先级是"+currentThread().getPriority());
        }
    }
}
class MyThread4 extends Thread{
    @Override
    public void run() {
        for(int i=0;i<10;i++){
            System.out.println("当前线程是："+currentThread().getName()+",线程优先级是："+currentThread().getPriority());
        }
    }
}